package com.java8feature.java8action.chapter1;

import java.util.ArrayList;
import java.util.List;

import static java.util.Comparator.comparing;

/**
 * @Description:
 * @Author: yangzhiwei
 * @Date: 2021/5/16 9:26
 */
public class Test<T> {
    public static <T>  boolean judgeType(T a) {
        if (a instanceof  Number) {
            return true;
        }
        return false;
    }
    public static void main(String[] args) {
            Integer aaaa = null;
        System.out.println(judgeType(aaaa));

        System.out.println("judage complate!");
//        Apple a = new Apple();
//        List<Apple> list = new ArrayList<>();
//        list.add(a);
//        List<Apple> list1 =  Predicate.filter(list, (t) ->{t.getColor(); return true;});
//

        Predicate predicate = (s) ->"aaa" + "bbbb";

        Apple1<Apple> a1 = new Apple1();
        a1.set(new Apple());
        //Apple[] apples = a1.get();

       // elementData.getClass() != Object[].class
        Object[] objects = new Object[1];
        Apple1[] apple11 = new Apple1[1];
        Apple[] apples1 = new Apple[1];

        System.out.println(objects.getClass() == Object[].class);
        System.out.println(apple11.getClass() == Apple1[].class);
        List<? extends Apple> list111 = new ArrayList<>();
        List<String> List111 = new ArrayList<>();
        //list111 = List111;
      //  list111.sort((Apple a4, Apple a5) ->a4.getWeight() - a4.getWeight());
        list111.sort( comparing(Apple::getWeight));
        List list;
        //list.stream().map()
    }

//    private static List filter(List<Apple> list, Predicate<Apple> predicate) {
//        return null;
//    }
}
